package easycloud.ecs.provider.model.baidu;

import java.io.InputStream;

import com.baidu.inf.iis.bcs.model.DownloadObject;

import easycloud.ecs.common.domain.Item;
import easycloud.ecs.provider.model.IStorageObject;

public class BaiduStorageObject implements IStorageObject {

	private DownloadObject object;

	private Item item;

	public BaiduStorageObject(DownloadObject downloadObject, Item item) {
		object = downloadObject;
		this.item = item;
	}

	@Override
	public String getHash() {
		return object.getObjectMetadata().getETag();
	}

	@Override
	public Item getItem() {
		return item;
	}

	@Override
	public String getKey() {
		return item.getPath();
	}

	@Override
	public long getLength() {
		return object.getObjectMetadata().getContentLength();
	}

	@Override
	public InputStream getObjectContent() {
		return object.getContent();
	}
}
